import os,psutil,sys
# 杀掉指定进程名的进程ID
def kill(proc_pid):
    process = psutil.Process(proc_pid)
    for proc in process.children(recursive=True):
        proc.kill()
        process.kill()

# 获取指定进程名的进程ID
def get_pid_by_name(process_name):
    for proc in psutil.process_iter(['pid', 'name']):
        if proc.info['name'] == process_name:
            return proc.info['pid']
    return None
for proc in psutil.process_iter():
    try:
        if proc.name()=="iudge-org.exe":
            os.system(r'taskkill /F /IM {}'.format("iudge-org.exe"))
    except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
        pass
os.startfile(r"D:\Ax\手工T0-仿真\UFX版本验收测试\hjlh-iudge-uat\iudge-org.exe")
